package top.ahzy.seobench.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import top.ahzy.seobench.service.ImgService;

import javax.servlet.http.HttpServletRequest;
import javax.validation.constraints.NotEmpty;
import java.io.IOException;

@Api(tags = "图片")
@RestController
@RequestMapping("/img")
public class ImgController {
    @Autowired
    private ImgService imgService;

    @GetMapping("/getIcon/{imgUrlBase}")
    @ApiOperation(value = "获取图片资源",notes = "")
    public ResponseEntity<InputStreamResource> getIconBase(HttpServletRequest request,@PathVariable @NotEmpty(message = "base不能为空")String imgUrlBase) throws IOException {
        return imgService.getIconBase(request,imgUrlBase);
    }



}
